import pymongo

conn=pymongo.MongoClient(host='101.201.102.37',port=28019)
param=conn['crawl_params']['ssgs_code']
top10_share=conn['final_data']['top_ten_shareholder']

# params=[]
# for i in param.find():
#     params.append(i.get('_id'))
# top10=[]
# for i in top10_share.find():
#     top10.append(i.get('code'))
# result=[]
# for i in params:
#     if i not in top10:
#         result.append(i)
# print '---------------------------------------------------------------------------------------'
# print result


lista=[u'sz000048', u'sz000159', u'sz000605', u'sz000639', u'sz000669', u'sz000732', u'sz000885', u'sz002029', u'sz002041', u'sz002046', u'sz002105', u'sz002164', u'sz002195', u'sz002216', u'sz002280', u'sz002469', u'sz002557', u'sz002585', u'sz002650', u'sz002685', u'sz300015', u'sz300027', u'sz300251', u'sz300368', u'sz300410', u'sz300482', u'sh600021', u'sh600391', u'sh600643', u'sh600712', u'sh600785', u'sh600871', u'sh601866', u'sh601901', u'sh603636', u'sh603686', u'sh900936', u'sz300510', u'sz300309', u'sz002231', u'sz002806', u'sh603663', u'sz300547', u'sh603090']
# for i in lista:
#     collection={}
#     collection['_id']=i
#     collection['code']=i
#     collection['status']=1
#
#     find_coll={}
#     find_coll['_id']=i
#     param.update(find_coll,collection)

# for i in lista:
#     if  i not in top10:
#         print i


listb=[u'sz002164']
for i in listb:
    collection={}
    collection['_id']=i
    collection['code']=i
    collection['status']=4

    find_coll={}
    find_coll['_id']=i
    param.update(find_coll,collection)